<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"></meta>
	<script src="/lib/jquery.js"></script>
	<script src="/lib/jquery.websocket.js"></script>
	<script type="text/javascript">
var test = {
	wsconnect: function () {
		test.ws = $.websocket("ws://" + location.host + "/aurora/test", {
            open: function () {
                console.log("连接成功");
            },
            close: function () {
                console.log("连接关闭");
            },
            events: {
                say: function (e) {
                    console.log("收到以下消息");
                    console.log(e);
                }
            },
            message: function (msg) {
                var data = eval("(" + msg.originalEvent.data + ")");
                console.log(data);
            }
        });
    },
    
    send : function (type, data) {
    	this.ws.send(type, data);
    }
}

window.onload = test.wsconnect;
	</script>
	<title>WebSocket 测试页</title>
</head>
<body>
</body>
</html>